package com.yinhai.msg.email.service.read.impl;

import com.yinhai.msg.email.entity.MsgEmailPo;
import com.yinhai.msg.email.mapper.read.MsgEmailReadMapper;
import com.yinhai.msg.email.service.read.MsgEmailReadService;
import com.yinhai.ta404.core.restservice.requestbean.PageParam;
import com.yinhai.ta404.core.restservice.resultbaen.Page;
import com.yinhai.ta404.core.transaction.annotation.TaTransactional;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * 邮箱配置表(MsgEmail)表服务实现类
 *
 * @author makejava
 * @since 2019-03-14 10:25:32
 */
@Service("msgEmailReadService")
@TaTransactional(readOnly = true)
public class MsgEmailReadServiceImpl implements MsgEmailReadService {
    @Resource
    private MsgEmailReadMapper msgEmailReadMapper;

    @Override
    public MsgEmailPo getEmailByEmailAddress(String emailAddress) {
        return msgEmailReadMapper.queryByEmailAddress(emailAddress);
    }

    /**
     * 通过ID查询单条数据
     *
     * @param id 主键
     * @return 实例对象
     */
    @Override
    public MsgEmailPo queryById(String id) {
        return this.msgEmailReadMapper.queryById(id);
    }

    /**
     * 通过ID查询单条数据
     *
     * @return 实例对象
     */
    @Override
    public Page<MsgEmailPo> queryAll(MsgEmailPo msgEmail,PageParam pageParam) {
        msgEmailReadMapper.beginPager(pageParam);
        return msgEmailReadMapper.endPager(msgEmailReadMapper.queryAll(msgEmail));
    }

}
